#@weiXinLayout("首页")

#define weiXinCss()
<style>
    .center{
        text-align: center;
    }


    .icon-item{
        height: 60px;
    }
    .icon-text{
        font-size: 14px;
        color: #7F8389;
    }
    .shadow{
        padding-bottom: 20px;
        padding-top: 15px;
        box-shadow: 1px 1px 1px #e8e6e6;
        margin-bottom: 5px;
    }

    .icon-size{
        width: 36px;
        height: 36px;
        padding: 5px;
        border-radius: 100%;
    }


    .icon-activity{
        background-color: #5DAFE4;
    }
    .icon-room{
        background-color: #F57375;
    }
    .icon-private{
        background-color: #F3A537;
    }
    .icon-guider{
        background-color: #AF75BB;
    }
</style>
#end

#define weiXinMain()
<div>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            #for(x:pics)
            <div class="swiper-slide">
                <a href="#(x.url??'')">
                    <img class="slide-item" src="#(x.cover??'')" alt="">
                </a>
            </div>
            #end
        </div>
        <div class="swiper-pagination"></div>
    </div>
    <div class="shadow">
        <div class="weui-flex center">
            <div class="weui-flex__item icon-item" data-url="#(contextPath)/weixin/activity">
                <img class="icon-activity icon-size" src="#(contextPath)/assets/front/img/icon/ic_group_white_48dp.png">
                <div class="icon-text">活动</div>
            </div>
            <div class="weui-flex__item icon-item" data-url="#(contextPath)/weixin/room">
                <img class="icon-room icon-size" src="#(contextPath)/assets/front/img/icon/ic_hotel_white_48dp.png">
                <div class="icon-text">客栈</div>
            </div>
            <div class="weui-flex__item icon-item" data-url="#(contextPath)/weixin/personal">
                <img class="icon-private icon-size" src="#(contextPath)/assets/front/img/icon/ic_grade_white_48dp.png">
                <div class="icon-text">订制活动</div>
            </div>
            <div class="weui-flex__item icon-item" data-url="#(contextPath)/weixin/market">
                <img class="icon-guider icon-size" src="#(contextPath)/assets/front/img/icon/ic_domain_white_48dp.png">
                <div class="icon-text">特产商城</div>
            </div>
        </div>
    </div>
    <div class="weui-flex">
        <div class="activity-title">最新活动</div>
    </div>
    <div class="activity-item-container" id="content">
    </div>
    #include("../front/common/wx-tab-bar.html")
</div>
#end


#define weiXinJs()
<script type="text/x-mustache" id="template">
    {{#items}}
    <div class="activity-item" data-url="#(contenxtPath)/weixin/activity/activityDetail?id={{id}}">
            <img class="slide-item" src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=4195794405,348409511&fm=15&gp=0.jpg">
            <div class="activity-item-title" >{{name}}</div>
            <p class="activity-item-desc">{{desc}}</p>
            <div class="activity-bottom-container">
                <img class="icon-avatar" src="{{avatar}}">
                <span class="item-price">￥{{price}}/人<span class="status">{{status}}</span></span>

            </div>
        </div>
    {{/items}}
</script>
<script>
    $(document).ready(function(){

        $(".swiper-container").swiper({
            loop: true,
            autoplay: 3000,
        });

        $(".icon-item").click(function(){
            var url = $(this).attr("data-url");
            window.location.href=url;
        });

        $("#content").on('click',".activity-item",function(){
            var url = $(this).attr("data-url");
            window.location.href=url;
        });
        var config ={
            "url":"#(contextPath)/weixin/ajaxIndex",
            "data":{},
            "successCallBack":function(resp){
                if(resp.result){
                    var temp = $("#template").html();
                    var content = Mustache.render(temp,{items:resp.data.activityList});
                    $("#content").html(content);
                }
            }
        }
        var ajax = new AjaxUtils(config);
        ajax.executeRequest();
    });
</script>
#end